home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir42 / c7105.zip / FILECTRL.TPX < prev    next >
Text File  |  1994-03-02  |  6KB  |  82 lines

  1. #!┌───────────────────────────┤Template Segment├───────────┬─────────────────┐
  2. #!│                              FileCtrl.TPX              │Version: 3007.105│
  3. #!├───────────────────────────────┤Contents├───────────────┴─────────────────┤
  4. #!│Structure             Type       Description                              │
  5. #!│────────────────────  ─────────  ─────────────────────────────────────────│
  6. #!│FileControl           GROUP      Controls the writing of File Control Code│
  7. #!│ScrLookupFileControl  GROUP      Finds screens fields with lookups        │
  8. #!│RelatedFileControl    GROUP      Finds related (child) files              │
  9. #!│WriteFileControl      GROUP      Writes File Opening/Closing Code         │
  10. #!├───────────────────────────────┤Comments├─────────────────────────────────┤
  11. #!│Version   Comments                                                        │
  12. #!│────────  ────────────────────────────────────────────────────────────────│
  13. #!│3007.000  Release of CDD3 version 3007 templates                          │
  14. #!└──────────────────────────────────────────────────────────────────────────┘
  15. #!
  16. #GROUP(%FileControl)
  17. #IF(%CloseFiles OR (%FileControlMode='1'))       #! If necessary to process
  18.   #SET(%OpenedFiles,',')                         #! Initialize dup tracking
  19.   #IF(%Primary)                                  #! IF a primary file defined
  20.     #FIX(%File,%Primary)                         #! FIX for file processing
  21. #INSERT(%WriteFileControl)                       #! Write F/C Code
  22.   #ENDIF                                         #! END (IF a primary...)
  23.   #FOR(%Secondary)                               #! FOR secondary file defined
  24.     #FIX(%File,%Secondary)                       #! FIX for file processing
  25. #INSERT(%WriteFileControl)                       #! Write F/C Code
  26.   #ENDFOR                                        #! END (For secondary...)
  27.   #IF(%Screen)                                   #! IF a screen is used
  28. #INSERT(%ScrLookupFileControl)                   #! Write Screen F/C Code
  29.   #ENDIF                                         #! END (IF a screen is used)
  30.   #IF(%ControlRelatedFiles)                      #! IF 1:Many related files
  31.     #IF(%FileControlMode=%Null)                  #! IF writing declarations
  32.       #SET(%RefIntFile,%Primary)                 #! SET for recursive write
  33. #INSERT(%RelatedFileControl)                     #! Write Related F/C Code
  34.     #ENDIF                                       #! END (IF writing dec...)
  35.   #ENDIF                                         #! END (IF 1:Many related...)
  36. #ENDIF                                           #! END (IF necessary to ...)
  37. #IF(%FileControlMode<'2')                        #! IF NOT writing close code
  38.   #SET(%FileControlMode,(%FileControlMode+1))    #! Increment control mode
  39. #ENDIF                                           #! END (IF NOT writing...)
  40. #!***************************************************************************
  41. #GROUP(%ScrLookupFileControl)                    #!Screen File Control Code
  42. #FOR(%ScreenField)                               #! FOR each screen field
  43.   #IF(%ScreenFieldType = 'ENTRY')                #! IF an entry field
  44.     #FIX(%Field,%ScreenFieldUse)                 #! FIX to process field
  45.     #IF(%FieldLookup)                            #! IF Must Be In File
  46.       #FIX(%File,%FieldLookup)                   #! FIX for file processing
  47. #INSERT(%WriteFileControl)                       #! Write F/C Code
  48.     #ENDIF                                       #! END (IF Must Be In File)
  49.   #ENDIF                                         #! END (IF an entry field)
  50. #ENDFOR                                          #! END (FOR each screen field)
  51. #!***************************************************************************
  52. #GROUP(%RelatedFileControl)                      #!Related Files File Control
  53. #FOR(%File)                                      #! FOR each file in system
  54.   #SET(%ChildPre,('['&%FilePre&']'))             #! Prep to search for prefix
  55.   #IF((INSTRING(%ChildPre,%RelatedChildList,1,1)))#! IF FILE is child in PROC
  56. #INSERT(%WriteFileControl)                       #! Write F/C Code
  57.   #ENDIF                                         #! END (IF FILE is child...)
  58. #ENDFOR                                          #! END (FOR each file...)
  59. #!***************************************************************************
  60. #GROUP(%WriteFileControl)                        #!Write File Control Code
  61. #SET(%AddString,(','&%FilePre))                  #! To track duplicates
  62. #SET(%SearchString,(%AddString&','))             #! TO search for duplicate
  63. #IF(INSTRING(%SearchString,%OpenedFiles,1,1)='0')#! IF code NOT written for file
  64.   #SET(%OpenedFiles,(%AddString&%OpenedFiles))   #! FLAG that code written
  65.   #IF(%FileControlMode=%Null)                    #! IF declaring flags
  66. %FilePre::Opened BYTE                            #<! TRUE is PROC opens file
  67.   #ELSIF(%FileControlMode='1')                   #! ELSE IF opening files
  68.     #IF(%CloseFiles)                             #! IF closing opened files
  69. %FilePre::Opened = CheckOpen(%File)              #<! Open file if necessary
  70.     #ELSE                                        #! ELSE (NOT closing...)
  71. CheckOpen(%File)                                 #<! Open file if necessary
  72.     #ENDIF                                       #! END (IF closing opened...)
  73.   #ELSIF(%FileControlMode='2')                   #! ELSE IF closing files
  74. IF %FilePre::Opened THEN CLOSE(%File).           #<! IF opened, close file
  75.   #ELSE                                          #! ELSE IF other mode
  76.     #SET(%ErrorMessage, (%Procedure & ' ERROR: Unknown Form Opens Mode:' & %FileControlMode))
  77.     #ERROR(%ErrorMessage)                        #! POST error to user
  78.   #ENDIF                                         #! END (IF F/C Mode...)
  79. #ENDIF                                           #! END (IF code NOT...)
  80. #!***************************************************************************
  81. #CHAIN('Relation.tpx')
  82.